module SolrPaginationExtender

  ResultsPerPage = 10

  def total_pages
    (self.total - 1) / results_per_page
  end

  def current_page
    self.start / results_per_page + 1
  end

  def previous_page
    current_page == 1 ? nil : (current_page - 1)
  end

  def next_page
    current_page == total_pages ? nil : (current_page + 1)
  end

  def results_per_page
    ResultsPerPage
  end
end

